home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Chat & Communication
/
Digsby build 37
/
digsby_setup.exe
/
lib
/
M2Crypto
/
m2xmlrpclib.pyo
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2008-10-13
|
2KB
|
55 lines
# Source Generated with Decompyle++
# File: in.pyo (Python 2.5)
import base64
import string
import sys
from xmlrpclib import *
import M2Crypto
import SSL
import httpslib
import m2urllib
__version__ = M2Crypto.version
class SSL_Transport(Transport):
user_agent = 'M2Crypto_XMLRPC/%s - %s' % (__version__, Transport.user_agent)
def __init__(self, ssl_context = None, *args, **kw):
if getattr(Transport, '__init__', None) is not None:
Transport.__init__(self, *args, **kw)
if ssl_context is None:
self.ssl_ctx = SSL.Context('sslv23')
else:
self.ssl_ctx = ssl_context
def request(self, host, handler, request_body, verbose = 0):
(user_passwd, host_port) = m2urllib.splituser(host)
(_host, _port) = m2urllib.splitport(host_port)
h = httpslib.HTTPS(_host, int(_port), ssl_context = self.ssl_ctx)
if verbose:
h.set_debuglevel(1)
h.putrequest('POST', handler)
h.putheader('Host', _host)
h.putheader('User-Agent', self.user_agent)
h.putheader('Content-Type', 'text/xml')
h.putheader('Content-Length', str(len(request_body)))
if user_passwd is not None:
auth = string.strip(base64.encodestring(user_passwd))
h.putheader('Authorization', 'Basic %s' % auth)
h.endheaders()
if request_body:
h.send(request_body)
(errcode, errmsg, headers) = h.getreply()
if errcode != 200:
raise ProtocolError(host + handler, errcode, errmsg, headers)
self.verbose = verbose
return self.parse_response(h.getfile())